home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #2
/
Amiga Plus CD - 1995 - No. 2.iso
/
pd
/
mui
/
mirrormanager
/
rexx
/
mirrormanager.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-04-11
|
8KB
|
302 lines
/*rx
** $VER: $Id: MirrorManager.rexx,v 1.13 1994/06/20 01:07:59 tf Exp $
**
** Initial revision by Tobias Ferber, 4.3.94
**
** This is the configuration script for the MirrorManager GUI.
** When loaded from within a MirrorManager application it will configure
** this application by adding the ListView entries below.
** However it is also executable via RX. (therefore the extension ".rexx")
** If executed from outside a MirrorManager host it will look for a host with
** an empty ListView and it will configure this host if it exists.
** Otherwise -- if there is no empty MirrorManager ListView available it
** will run a new MirrorManager GUI application and configure that one.
**
** Feel free to change the path and filenames below. This example
** configuration is designed to fit on my own installation only.
** Note that MirrorManager needs neither assignments nor environment
** variables. All the logical devices below are my personal settings.
** If you prefer using a different hierarchy then feel free to change
** the pathnames below to your personal taste or needs.
**
** You can also use the configure script to change the assignments below.
*/
/*@*/
IncomingPath = "incoming:"
AminetPath = "downloads:aminet"
KickedPath = "downloads:aminet/kicked"
FastIndexPath = "downloads:aminet/fastindex"
AminetIndexFile = "downloads:aminet/INDEX"
AminetRecentFile = "downloads:aminet/RECENT"
AminetTreeFile = "downloads:aminet/TREE"
LocalIndexFile = "downloads:aminet/LOCAL"
WantedIndexFile = "downloads:aminet/WANTED"
HiddenFile = "downloads:aminet/HIDDEN"
IndexedFile = "downloads:aminet/INDEXED"
RemapFile = "downloads:aminet/MAP"
/*@*/
/* There should be no need for you to change the following values */
myname = whoami('resolved')
mm_path = left(myname,lastpos('/REXX/',upper(myname)))
portbase = 'MIRRORMANAGER.'
appstart = "run /MirrorManager"
def_stacksize = 10240
/*** / GET HOST / ***/
options results
if( arg() > 0 ) then do
parse arg portname
if abbrev(portname,portbase) then address(portname)
else do
say 'Usage:' myname '[ MIRRORMANAGER.<x> ]'
exit
end
end
else do
if ~abbrev(address(),portbase) then do
portlist = SHOW('P',,'0A'X)
do while words(portlist) > 0
parse var portlist portname '0A'X portlist
if abbrev(portname,portbase) then do
address(portname); 'NUMENTRIES'
if result = 0 then portlist= ""
else address
end
end
if address() ~= portname then do
/*say '"'myname'" running "'appstart'"'*/
stacksize= pragma('S',def_stacksize)
address command appstart 'CONFIGNAME="'myname'"'
call pragma('S',stacksize)
exit
end
end
else portname = address()
end
/*** / ADD ITEMS / ***/
CLEAR
CONFIGURABLE TRUE
/*say '"'myname'" configuring "'address()'"'*/
CONFIGNAME '"'myname'"'
add_item( 'Create/Update Aminet TREE',,
'rexx/MakeTree',,
'FROM' '"'AminetTreeFile'"',
'TO' '"'AminetPath'"',
'AUTO' )
add_item( 'Delete Empty Directories',,
'rexx/CutTree',,
'PATH' '"'AminetPath'"',
'AUTO' )
add_item( 'Update Aminet DirNotes',,
'rexx/MakeTree',,
'FROM' '"'AminetTreeFile'"',
'TO' '"'AminetPath'"',
'NOCREATE',
'AUTO' )
add_item( 'Add FileNotes to INCOMING',,
'rexx/CleanupIncoming',,
'FROM' '"'IncomingPath'"',
'FAST WITH' '"'FastIndexPath'"',
'AUTO' )
add_item( 'Add FileNotes from RECENT',,
'rexx/CleanupIncoming',,
'FROM' '"'IncomingPath'"',
'WITH' '"'AminetRecentFile'"',
'AUTO' )
add_item( 'Add FileNotes from WANTED',,
'rexx/CleanupIncoming',,
'FROM' '"'IncomingPath'"',
'WITH' '"'WantedIndexFile'"',
'AUTO' )
add_item( 'Cleanup INCOMING',,
'rexx/CleanupIncoming',,
'MOVE FAST FROM' '"'IncomingPath'"',
'TO' '"'AminetPath'"',
'WITH' '"'FastIndexPath'"',
'AUTO' )
if (right(IncomingPath,1) ~= ':') & (right(IncomingPath,1) ~= '/') then newRecentFile= IncomingPath || '/RECENT'
else newRecentFile= IncomingPath || 'RECENT'
add_item( 'Cleanup with new RECENT',,
'rexx/CleanupIncoming',,
'MOVE FROM' '"'IncomingPath'"',
'TO' '"'AminetPath'"',
'WITH' '"'newRecentFile'"',
'AUTO' )
add_item( 'Create FAST Index',,
'rexx/SplitIndex',,
'FROM' '"'AminetIndexFile'"',
'TO' '"'FastIndexPath'"',
'AUTO' )
add_item( 'Create/Update LOCAL Index',,
'rexx/MakeIndex',,
'FROM' '"'AminetPath'"',
'TO' '"'LocalIndexFile'"',
'HIDE WITH' '"'HiddenFile'"',
'AUTO' )
add_item( 'Edit LOCAL Index File',,
'"ADDRESS COMMAND ''ed ""'LocalIndexFile'""''"')
add_item( 'Sort LOCAL Index File',,
'rexx/SortIndex',,
'FROM' '"'LocalIndexFile'"',
'AUTO' )
add_item( 'Examine LOCAL Index File',,
'rexx/ExamineIndex',,
'FAST COMMENT FILE' '"'LocalIndexFile'"',
'WITH' '"'FastIndexPath'"',
'PATH' '"'AminetPath'"',
'AUTO' )
add_item( 'Reorganize Local Mirror',,
'rexx/ExamineIndex',,
'FILE' '"'LocalIndexFile'"',
'RELOCATE COMMENT FAST',
'WITH' '"'FastIndexPath'"',
'PATH' '"'AminetPath'"',
'KICK' '"'KickedPath'"',
'AUTO' )
add_item( 'Re-Insert Kicked Out Files',,
'rexx/CleanupIncoming',,
'MOVE FROM' '"'KickedPath'"',
'TO' '"'AminetPath'"',
'WITH' '"'LocalIndexFile'"',
'AUTO' )
add_item( 'Sort Aminet INDEX File',,
'rexx/SortIndex',,
'FROM' '"'AminetIndexFile'"',
'AUTO' )
add_item( 'Edit Aminet INDEX File',,
'"ADDRESS COMMAND ''ed ""'AminetIndexFile'""''"')
add_item( 'Edit WANTED Index',,
'"ADDRESS COMMAND ''ed ""'WantedIndexFile'""''"')
add_item( 'Edit Configuration Script',,
'"OPTIONS RESULTS; CONFIGNAME; script= result; ADDRESS COMMAND ''ed ""''script''""''"')
add_item( 'Generate brief Status from Log','rexx/Status.mm')
EXIT
/*@*/
/*** / PROCEDURES / ***/
add_item: procedure
parse arg name,command,args
ADD transquote(name) transquote(command) transquote(args)
return rc
/**/
transquote: procedure
parse arg s
t= s
q= max( lastpos('*',s), lastpos('"',s) )
do while q > 0
t= insert('*',t,q-1,1)
s= left(s,q-1)
q= max( lastpos('*',s), lastpos('"',s) )
end
return '"' || t || '"'
/*
** This procedure resolves the scriptfile path and filename
*/
whoami: procedure
arg cr
parse source . . s
/* --> s = <called> <resolved> <extension> <host> */
lib= show('L',"rexxsupport.library")
if ~lib then lib= addlib("rexxsupport.library",0,-30,0)
if lib then do
vlist= showlist('v',,':') || ':'
call remlib("rexxsupport.library")
/* find the last position p of a legal volume name (terminated with a colon) in s */
p= 0
do while (words(vlist) > 0) & (p = 0)
parse var vlist vol ':' vlist
p= lastpos(vol':',upper(s))
end
if p > 1 then called= strip( left(s,p-1) ) /* <called> ends at position (p-1) */
end
else do /* ~rexxsupport.library */
t= left(s,lastpos(':',s))
called= strip( left(t,lastpos(' ',t)) )
call pragma('W','N')
do while ~exists(called) & lastpos(' ',called) > 0
called= left(called,lastpos(' ',called)-1)
end
end
/* extract <resolved> from s */
if left(cr,1) = 'R' then do
host= address()
parse var s (called) s (host) .
/* --> s = <resolved> if <extension> = <host>
or s = <resolved> <extension> if <extension> ~= <host> */
resolved= strip(s)
call pragma('W','N')
do while ~exists(resolved)
resolved= left(resolved,lastpos(' ',resolved)-1)
end
end
if left(cr,1) = 'R' then return resolved
else return called
/* END */